package lg.minecraft.plugin.pokemonmenu.gui;

import lg.minecraft.plugin.library.inventory.CancelInventoryContext;
import lg.minecraft.plugin.library.inventory.InventoryContext;
import lg.minecraft.plugin.library.inventory.LGInventory;
import lg.minecraft.plugin.pokemonmenu.LGPokemonMenu;
import org.bukkit.entity.Player;

/**
 * @author langle__
 * @version 1.0
 */
public abstract class PInventory extends LGInventory {

    public PInventory(int line, String title) {
        super(line, title);
    }

    public PInventory(int line) {
        super(line);
    }

    public abstract void onDrawInventory(Player player);

    @Override
    public void onInventoryOpen(CancelInventoryContext context) {
        Player player = context.getPlayer();
        LGPokemonMenu.addOpeningInventory(player, this);
        onDrawInventory(player);
    }

    @Override
    public void onInventoryClose(InventoryContext context) {
        LGPokemonMenu.removeOpeningInventory(context.getPlayer());
    }

}
